package com.itheima01;

import java.util.HashSet;
import java.util.Iterator;

public class hashset {
    public static void main(String[] args) {
        HashSet<String> hs = new HashSet<>();
        hs.add(new String("1"));
        hs.add(new String("2"));
        hs.add(new String("3"));
        hs.add(new String("4"));
        for (String h : hs) {
            System.out.println(h);
        }
        System.out.println("===================");
        hs.forEach(s -> System.out.println(s));
        System.out.println("===================");
        Iterator<String> b = hs.iterator();
        while (b.hasNext()) {
            String next = b.next();
            System.out.println(next);
        }

    }
}
